﻿
namespace HSS.Xaml.UI.Controls
{
	#region Using Directives
	using System.ComponentModel;
	#endregion

	#region ComboBoxItemObject
	/// <summary>
	/// An Object Container that encapsulates an Object's raw value, and it's
	/// ToString value and is set as the ComboBox's ItemsSource as a List of 
	/// ComboBoxItemObjects
	/// </summary>
	public sealed class ComboBoxItemObject : INotifyPropertyChanged
	{
		#region Events
		/// <summary>
		/// Event fired when the Object Display or Value is modified
		/// </summary>
		public event PropertyChangedEventHandler PropertyChanged;
		void OnPropertyChanged(string name)
		{
			PropertyChangedEventHandler handler = PropertyChanged;
			if (null != handler)
				handler(this, new PropertyChangedEventArgs(name));
		}
		#endregion

		#region Constructors
		/// <summary>
		/// Constructor
		/// </summary>
		public ComboBoxItemObject()
		{

		}
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="displayText">The DisplayName of the Object (typically the result of calling object.ToString())</param>
		/// <param name="value">The Objects actual value</param>
		public ComboBoxItemObject(string displayText, object value)
		{
			this.ObjectDisplay = displayText;
			this.ObjectValue = value;
		}
		#endregion

		#region Properties
		/// <summary>
		/// Gets or sets the DisplayName of the Object (typically the result of 
		/// calling object.ToString())
		/// </summary>
		public string ObjectDisplay
		{
			get { return _displayName; }
			set
			{
				_displayName = value;
				OnPropertyChanged("ObjectDisplay");
			}
		} string _displayName;
		/// <summary>
		/// Gets or sets the Objects actual value
		/// </summary>
		public object ObjectValue
		{
			get { return _itemValue; }
			set
			{
				_itemValue = value;
				OnPropertyChanged("ObjectValue");
			}
		} object _itemValue;
		#endregion
	}
	#endregion
}
